package cn.chengpengper.shortlink.config;

import cn.chengpengper.shortlink.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author huchengpeng
 * @version v1.0.0
 * @date 2023/9/2 19:15
 * @description 登录拦截器配置
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/api/account/*/**", "/api/traffic/*/**")
                .excludePathPatterns("/api/captcha/*/getCaptcha", "/api/notify/*/sendCode", "/api/account/*/register", "/api/account/*/login");
    }
}
